using System;
using System.Collections.Generic;
using Library;
using Library.Util;
using NHibernate;

namespace Library.Persistence.Cloud.Dao
{
	public class CloudFirmaDao : BaseEntity
	{
		private readonly string fromHql = " from CloudFirma as t ";
		public void Insert(CloudFirma dto)
		{
			BasePersistence.Insert(dto);
		}

		public void Update(CloudFirma dto)
		{
			BasePersistence.Update(dto);
		}

		public void Delete(CloudFirma dto)
		{
			BasePersistence.Delete(dto);
		}

		public void Delete(int firmaId)
		{
			CloudFirma dto = new CloudFirma();
			dto.FirmaId = firmaId;
			Delete(dto);
		}

		public CloudFirma Get(int firmaId, LockMode lockMode)
		{
			return Get<CloudFirma>(firmaId, lockMode);
		}

		public List<CloudFirma> FindAll()
		{
			return Find<CloudFirma>(fromHql, LockMode.Read);
		}

		public List<CloudFirma> FindAll(string orderStatement)
		{
			return Find<CloudFirma>(fromHql + " ORDER BY " + orderStatement, LockMode.Read);
		}

	}
}
